package com.huawei.classroom.student.h17;

public class Barrack extends GameObject{
	public Barrack(Player player, int x, int y) {
		super(player, x, y, BattleField.getread_ini("barrack.range"), BattleField.getread_ini("barrack.strength"), BattleField.getread_ini("barrack.health"));
	}
	
	public GameObject traing(EnumObjectType type) {//创建角色
		GameObject gameObject = null;
		if(type == EnumObjectType.rifleSoldier) {
			gameObject = new RifleSoldier(getplayer(), getX(), getY());
		}
		else if(type == EnumObjectType.RPGSoldier) {
			gameObject = new RPGSoldier(getplayer(), getX(), getY());
		}
		else if(type == EnumObjectType.dog) {
			gameObject = new Dog(getplayer(), getX(), getY());
		}
		else return gameObject;
		BattleField.gameObjects.add(gameObject);
		return gameObject;
	}
}
